Identifying Classes in Legacy JavaScript Code
نویسندگان
چکیده
1Department of Computer Science, Federal University ofMinas Gerais, Belo Horizonte, Brazil 2Department of Computer Science, DCC Pleiad Lab, University of Chile, Santiago, Chile 3RMod Project Team, INRIA Lille Nord Europe, France Correspondence Leonardo Humberto Silva, Department of Informatics, Federal Institute of Northern Minas Gerais, Salinas, Brazil. Email: [email protected] Funding information STICAmSud, Grant/AwardNumber: 14STIC-02; FONDECYT, Grant/Award Number: 1160575 Abstract JavaScript is the most popular programming language for the Web. Although the language is prototype-based, developers can emulate class-based abstractions in JavaScript to master the increasing complexity of their applications. Identifying classes in legacy JavaScript code can support thesedevelopersat least in the followingactivities: (1)programcomprehension; (2)migration to the new JavaScript syntax that supports classes; and (3) implementation of supporting tools, including IDEs with class-based views and reverse engineering tools. In this paper, we propose a strategy to detect class-based abstractions in the source code of legacy JavaScript systems. We report on a large and in-depth study to understand how class emulation is employed, using a dataset of 918 JavaScript applications available on GitHub. We found that almost 70% of the JavaScript systems we study make some usage of classes. We also performed a field study with themain developers of 60 popular JavaScript systems to validate our findings. The overall results range from 97% to 100% for precision, from 70% to 89% for recall, and from 82% to 94% for F-score.
منابع مشابه
Refactoring Legacy JavaScript Code to Use Classes: The Good, The Bad and The Ugly
JavaScript systems are becoming increasingly complex and large. To tackle the challenges involved in implementing these systems, the language is evolving to include several constructions for programmingin-the-large. For example, although the language is prototype-based, the latest JavaScript standard, named ECMAScript 6 (ES6), provides native support for implementing classes. Even though most m...
متن کاملConcrete Types for TypeScript
TypeScript extends JavaScript with optional type annotations that are, by design, unsound and, that the TypeScript compiler discards as it emits code. This design point preserves programming idioms developers are familiar with, and allows them to leave their legacy code unchanged, while offering a measure of static error checking in parts of the program that have type annotations. We present an...
متن کاملCSI5387: Data Mining Project
Web pages have become more like applications that documents. Not only do they provide dynamic content, they also allow users to play games, send email, and do many other tasks that used to be reserved for traditional applications. One of the major technologies enabling web application creation is JavaScript, which allows execution of code in the browser. Unfortunately, because it is so powerful...
متن کاملReducing the Class Coupling of Legacy Code by a Metrics-Based Relocation of Class Members
With the rapid growth of the complexity of software systems, the problem of integrating and maintaining legacy software is more relevant than ever. To overcome this problem, many methods for refactoring legacy code have already been proposed such as renaming classes or extracting interfaces. To perform a real modularization, methods have to be moved between classes. However, moving a single met...
متن کاملJSClassFinder: A Tool to Detect Class-like Structures in JavaScript
With the increasing usage of JavaScript in web applications, there is a great demand to write JavaScript code that is reliable and maintainable. To achieve these goals, classes can be emulated in the current JavaScript standard version. In this paper, we propose a reengineering tool to identify such class-like structures and to create an object-oriented model based on JavaScript source code. Th...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- Journal of Software: Evolution and Process
دوره 29 شماره
صفحات -
تاریخ انتشار 2017